<template>
	<view class="tiezilist">
		<view class="top">
			<image src='../../static/businessImg/back.png' class="topback" @click="back">
			</image>
			<view class="topname">
				动态详情
			</view>
		</view>
		
		<view class="tiezilistcenter">
			<view class="storeImg">
				<image :src="item.storeImage" style="width: 73rpx;height: 73rpx;" mode=""></image>
				<view class="storeName">
					{{item.storeName}}
				</view>
			</view>
			<view class="tiezititle">
				{{item.title}}
			</view>
			
			<view class="tiezilistitempic1" v-if="item.productImage!=null && item.productImage.length != 0 && item.productImage.split(',').length == 1 && item.type == 2">
				<image :src="item.productImage" style="height: 367rpx;" @click="previewImage([item.productImage],item.productImage)"></image>
			</view>
			
			
			<view class="tiezilistitempic2" v-if="item.productImage!=null && item.productImage.length != 0 && item.productImage.split(',').length > 1 && item.type == 2">
				<view class="tiezilistitempicitem" v-for="(i, index) in item.productImage.split(',')" :key="index" @click="previewImage(item.productImage.split(','), i)">
					<image :src="i" mode="" style="width: 218rpx;height: 218rpx;"></image>
				</view>
			</view>
			<view class="tiezilistitempic1" v-if="item.image!=null &&item.image.length != 0 && item.image.split(',').length == 1 && item.type == 1">
				<image :src="item.image" style="height: 367rpx;" @click="previewImage([item.image], item.image)"></image>
			</view>
			
			<view class="tiezilistitempic2" v-if="item.image!=null && item.image.length != 0 && item.image.split(',').length > 1 && item.type == 1" >
				<view class="tiezilistitempicitem" v-for="(i, index) in item.image.split(',')" :key="index" @click="previewImage(item.image.split(','),i)">
					<image :src="i" mode="" style="width: 218rpx;height: 218rpx;"></image>
				</view>
			</view>
			
			<view class="centertitle">
				{{item.content}}
			</view>
		</view>
	</view>
</template>

<script>
	import { postsData } from '@/api/storeAdmin.js'
	export default {
		data() {
			return {
				item: {
					
				},
				id: ''
			}
		},
		methods: {
			back() {
				uni.navigateBack({
					delta: 1
				});
			},
			
			 previewImage(urls, current) {
				 console.log(urls)
			      uni.previewImage({
			        urls:urls, // 需要预览的图片 HTTP 链接列表
			        current: current // 当前显示图片的链接，不填则默认为 urls 的第一张
			      });
			    }
		},
		onShow() {
			postsData({id: this.id}).then(res => {
				this.item = res.data
			})
			
		},
		onLoad(option) {
			this.id = option.id
		}
	}
</script>

<style scoped>
.tiezilist {
		width: 100%;
		min-height: 100vh;
	}

	.top {
		width: 100%;
		height: 188rpx;
		position: relative;
		background: #FFFFFF;
	}

	.topback {
		width: 16rpx;
		height: 29rpx;
		position: absolute;
		top: 106rpx;
		left: 32rpx;
	}

	.topname {
		width: 300rpx;
		height: 32rpx;
		text-align: center;
		font-family: Adobe Heiti Std;
		font-weight: normal;
		font-size: 33rpx;
		color: #222222;
		line-height: 32rpx;
		position: absolute;
		top: 104rpx;
		left: 50%;
		transform: translateX(-50%);
	}
	
	.tiezilistcenter {
		width: 100%;
		padding: 0 18rpx;
		padding-bottom: 140rpx;
	}
	.storeImg {
		display: flex;
		justify-content: flex-start;
		align-items: center;
	}
	.storeName {
		font-family: PingFang;
		font-weight: bold;
		font-size: 29rpx;
		color: #0D182E;
		padding-left: 21rpx;
	}
	.tiezititle {
		width: 100%;
		font-family: PingFang;
		font-weight: bold;
		font-size: 33rpx;
		color: #202224;
		margin-top: 52rpx;
	}
	
	.tiezilistitempic1 {
		width: 100%;
		height: 367rpx;
		margin-top: 27rpx;
	
		image {
			width: 100%;
			height: 100%;
		}
	}
	
	.tiezilistitempic2 {
		width: 100%;
		margin-top: 27rpx;
	}
	
	.tiezilistitempicitem {
		width: 214rpx;
		height: 214rpx;
		margin-top: 5rpx;
		margin-right: 10rpx;
		display: inline-block;
	
		image {
			width: 100%;
			height: 100%;
		}
	}
	
	.centertitle {
		width: 100%;
		font-family: PingFang;
		font-weight: 500;
		font-size: 31rpx;
		color: #202224;
		line-height: 52rpx;
		margin-top: 31rpx;
	}
</style>
